/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JFramePrincipal.java
 *
 * Created on 17/10/2011, 18:31:10
 */
package calculadoragala;
import java.text.NumberFormat;
import negocio.Aritmetic;
import negocio.Operacional;
import negocio.Trigonometrica;
/**
 *
 * @author Arthur
 */
public class JFramePrincipal extends javax.swing.JFrame {

    /** Creates new form JFramePrincipal */
    public JFramePrincipal() {
        initComponents();
    }
        NumberFormat df1 = NumberFormat.getNumberInstance();


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        JVisor1 = new javax.swing.JTextField();
        JSeletorDec = new javax.swing.JSpinner();
        jLabel2 = new javax.swing.JLabel();
        BotaoC1 = new javax.swing.JButton();
        BotaoBSpace1 = new javax.swing.JButton();
        BotaoCE1 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        BotaoMC = new javax.swing.JButton();
        BotaoMR = new javax.swing.JButton();
        BotaoMMais = new javax.swing.JButton();
        BotaoMS = new javax.swing.JButton();
        BotaoMMenos = new javax.swing.JButton();
        BotaoSinal = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        BotaoMenos = new javax.swing.JButton();
        BotaoMais = new javax.swing.JButton();
        BotaoDiv = new javax.swing.JButton();
        BotaoVezes = new javax.swing.JButton();
        BotaoLn = new javax.swing.JButton();
        BotaoLog10 = new javax.swing.JButton();
        BotaoPot = new javax.swing.JButton();
        BotaoQuadrado = new javax.swing.JButton();
        BotaoFatorial = new javax.swing.JButton();
        BotaoExp = new javax.swing.JButton();
        BotaoRaiz = new javax.swing.JButton();
        BotaoPcent = new javax.swing.JButton();
        BotaoIgual = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        BotaoNum1 = new javax.swing.JButton();
        BotaoNum4 = new javax.swing.JButton();
        BotaoNum7 = new javax.swing.JButton();
        BotaoNum9 = new javax.swing.JButton();
        BotaoNum8 = new javax.swing.JButton();
        BotaoNum6 = new javax.swing.JButton();
        BotaoNum5 = new javax.swing.JButton();
        BotaoNum3 = new javax.swing.JButton();
        BotaoNum2 = new javax.swing.JButton();
        BotaoNum0 = new javax.swing.JButton();
        BotaoVirgula = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        BotaoTangente = new javax.swing.JButton();
        BotaoSeno = new javax.swing.JButton();
        BotaoCosseno = new javax.swing.JButton();
        BotaoCotangente = new javax.swing.JButton();
        BotaoSecante = new javax.swing.JButton();
        BotaoCossecante = new javax.swing.JButton();
        RadioBotaoGraus = new javax.swing.JRadioButton();
        RadioBotaoRad = new javax.swing.JRadioButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Calculadora GALA 1.0");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(102, 102, 102));
        jPanel1.setMaximumSize(new java.awt.Dimension(420, 324));
        jPanel1.setMinimumSize(new java.awt.Dimension(420, 324));

        jPanel3.setBackground(new java.awt.Color(0, 0, 0));
        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setMaximumSize(new java.awt.Dimension(405, 92));
        jPanel3.setMinimumSize(new java.awt.Dimension(405, 92));

        JVisor1.setFont(new java.awt.Font("Tahoma", 0, 20));
        JVisor1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        JVisor1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JVisor1ActionPerformed(evt);
            }
        });
        JVisor1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                JVisor1KeyTyped(evt);
            }
        });

        JSeletorDec.setModel(new javax.swing.SpinnerNumberModel(2, 0, 9, 1));
        JSeletorDec.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        JSeletorDec.setRequestFocusEnabled(false);
        JSeletorDec.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                JSeletorDecStateChanged(evt);
            }
        });

        jLabel2.setBackground(new java.awt.Color(255, 255, 255));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Casas Decimais:");

        BotaoC1.setBackground(new java.awt.Color(0, 0, 0));
        BotaoC1.setForeground(new java.awt.Color(255, 255, 255));
        BotaoC1.setText("C");
        BotaoC1.setBorder(null);
        BotaoC1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoC1.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
        BotaoC1.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoC1.setMaximumSize(new java.awt.Dimension(11, 19));
        BotaoC1.setMinimumSize(new java.awt.Dimension(11, 19));
        BotaoC1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoC1ActionPerformed(evt);
            }
        });

        BotaoBSpace1.setBackground(new java.awt.Color(0, 0, 0));
        BotaoBSpace1.setForeground(new java.awt.Color(255, 255, 255));
        BotaoBSpace1.setText("←");
        BotaoBSpace1.setBorder(null);
        BotaoBSpace1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoBSpace1.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoBSpace1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoBSpace1ActionPerformed(evt);
            }
        });

        BotaoCE1.setBackground(new java.awt.Color(0, 0, 0));
        BotaoCE1.setForeground(new java.awt.Color(255, 255, 255));
        BotaoCE1.setText("Ce");
        BotaoCE1.setBorder(null);
        BotaoCE1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoCE1.setMargin(new java.awt.Insets(0, 0, 0, 0));
        BotaoCE1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoCE1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(JVisor1, javax.swing.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(BotaoC1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoCE1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 117, Short.MAX_VALUE)
                        .addComponent(jLabel2)
                        .addGap(8, 8, 8)
                        .addComponent(JSeletorDec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(12, 12, 12)
                        .addComponent(BotaoBSpace1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(JVisor1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotaoC1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoCE1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(JSeletorDec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoBSpace1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel5.setBackground(new java.awt.Color(0, 0, 0));
        jPanel5.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        BotaoMC.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMC.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMC.setText("Mc");
        BotaoMC.setBorder(null);
        BotaoMC.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMC.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMCActionPerformed(evt);
            }
        });

        BotaoMR.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMR.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMR.setText("Mr");
        BotaoMR.setToolTipText("");
        BotaoMR.setBorder(null);
        BotaoMR.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMR.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMR.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMRActionPerformed(evt);
            }
        });

        BotaoMMais.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMMais.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMMais.setText("M+");
        BotaoMMais.setBorder(null);
        BotaoMMais.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMMais.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMMais.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMMaisActionPerformed(evt);
            }
        });

        BotaoMS.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMS.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMS.setText("Ms");
        BotaoMS.setBorder(null);
        BotaoMS.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMS.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMSActionPerformed(evt);
            }
        });

        BotaoMMenos.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMMenos.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMMenos.setText("M-");
        BotaoMMenos.setToolTipText("");
        BotaoMMenos.setBorder(null);
        BotaoMMenos.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMMenos.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMMenos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMMenosActionPerformed(evt);
            }
        });

        BotaoSinal.setBackground(new java.awt.Color(0, 0, 0));
        BotaoSinal.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        BotaoSinal.setForeground(new java.awt.Color(255, 255, 255));
        BotaoSinal.setText("+ -");
        BotaoSinal.setBorder(null);
        BotaoSinal.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoSinal.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoSinal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoSinalActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(BotaoMC, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                .addComponent(BotaoMR, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotaoMS, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotaoMMais, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotaoMMenos, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotaoSinal, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotaoMC, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoSinal, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoMMenos, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoMMais, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoMS, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoMR, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBackground(new java.awt.Color(0, 0, 0));
        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jPanel4.setForeground(new java.awt.Color(255, 255, 255));

        BotaoMenos.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMenos.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BotaoMenos.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMenos.setText("-");
        BotaoMenos.setBorder(null);
        BotaoMenos.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMenos.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMenos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMenosActionPerformed(evt);
            }
        });

        BotaoMais.setBackground(new java.awt.Color(0, 0, 0));
        BotaoMais.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BotaoMais.setForeground(new java.awt.Color(255, 255, 255));
        BotaoMais.setText("+");
        BotaoMais.setBorder(null);
        BotaoMais.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoMais.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoMais.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoMaisActionPerformed(evt);
            }
        });

        BotaoDiv.setBackground(new java.awt.Color(0, 0, 0));
        BotaoDiv.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BotaoDiv.setForeground(new java.awt.Color(255, 255, 255));
        BotaoDiv.setText("÷");
        BotaoDiv.setBorder(null);
        BotaoDiv.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoDiv.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoDiv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoDivActionPerformed(evt);
            }
        });

        BotaoVezes.setBackground(new java.awt.Color(0, 0, 0));
        BotaoVezes.setForeground(new java.awt.Color(255, 255, 255));
        BotaoVezes.setText("X");
        BotaoVezes.setBorder(null);
        BotaoVezes.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoVezes.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoVezes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoVezesActionPerformed(evt);
            }
        });

        BotaoLn.setBackground(new java.awt.Color(0, 0, 0));
        BotaoLn.setForeground(new java.awt.Color(255, 255, 255));
        BotaoLn.setText("ln");
        BotaoLn.setBorder(null);
        BotaoLn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoLn.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
        BotaoLn.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoLn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoLnActionPerformed(evt);
            }
        });

        BotaoLog10.setBackground(new java.awt.Color(0, 0, 0));
        BotaoLog10.setForeground(new java.awt.Color(255, 255, 255));
        BotaoLog10.setText("log");
        BotaoLog10.setBorder(null);
        BotaoLog10.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoLog10.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoLog10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoLog10ActionPerformed(evt);
            }
        });

        BotaoPot.setBackground(new java.awt.Color(0, 0, 0));
        BotaoPot.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        BotaoPot.setForeground(new java.awt.Color(255, 255, 255));
        BotaoPot.setText("xª");
        BotaoPot.setBorder(null);
        BotaoPot.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoPot.setMargin(new java.awt.Insets(2, 0, 2, 0));
        BotaoPot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoPotActionPerformed(evt);
            }
        });

        BotaoQuadrado.setBackground(new java.awt.Color(0, 0, 0));
        BotaoQuadrado.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        BotaoQuadrado.setForeground(new java.awt.Color(255, 255, 255));
        BotaoQuadrado.setText("x²");
        BotaoQuadrado.setBorder(null);
        BotaoQuadrado.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoQuadrado.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoQuadrado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoQuadradoActionPerformed(evt);
            }
        });

        BotaoFatorial.setBackground(new java.awt.Color(0, 0, 0));
        BotaoFatorial.setForeground(new java.awt.Color(255, 255, 255));
        BotaoFatorial.setText("n!");
        BotaoFatorial.setBorder(null);
        BotaoFatorial.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoFatorial.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoFatorial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoFatorialActionPerformed(evt);
            }
        });

        BotaoExp.setBackground(new java.awt.Color(0, 0, 0));
        BotaoExp.setForeground(new java.awt.Color(255, 255, 255));
        BotaoExp.setText("exp");
        BotaoExp.setBorder(null);
        BotaoExp.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoExp.setMargin(new java.awt.Insets(2, 1, 2, 1));
        BotaoExp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoExpActionPerformed(evt);
            }
        });

        BotaoRaiz.setBackground(new java.awt.Color(0, 0, 0));
        BotaoRaiz.setForeground(new java.awt.Color(255, 255, 255));
        BotaoRaiz.setText("√");
        BotaoRaiz.setBorder(null);
        BotaoRaiz.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoRaiz.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoRaiz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoRaizActionPerformed(evt);
            }
        });

        BotaoPcent.setBackground(new java.awt.Color(0, 0, 0));
        BotaoPcent.setForeground(new java.awt.Color(255, 255, 255));
        BotaoPcent.setText("%");
        BotaoPcent.setBorder(null);
        BotaoPcent.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoPcent.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoPcent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoPcentActionPerformed(evt);
            }
        });

        BotaoIgual.setBackground(new java.awt.Color(0, 0, 0));
        BotaoIgual.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BotaoIgual.setForeground(new java.awt.Color(255, 255, 255));
        BotaoIgual.setText("=");
        BotaoIgual.setBorder(null);
        BotaoIgual.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoIgual.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoIgual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoIgualActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(BotaoQuadrado, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoPcent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoMenos, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(BotaoFatorial, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoRaiz, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoVezes, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(BotaoLog10, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoPot, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoDiv, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(BotaoLn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(BotaoExp, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(BotaoIgual, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoMais, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(BotaoQuadrado, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(BotaoPcent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(BotaoMenos, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(BotaoFatorial, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(BotaoRaiz, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoVezes, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(1, 1, 1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(BotaoLog10, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(BotaoPot, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(BotaoDiv, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(BotaoLn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoExp, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoIgual, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(BotaoMais, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6.setBackground(new java.awt.Color(0, 0, 0));
        jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));

        BotaoNum1.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum1.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum1.setText("1");
        BotaoNum1.setBorder(null);
        BotaoNum1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum1.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum1ActionPerformed(evt);
            }
        });

        BotaoNum4.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum4.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum4.setText("4");
        BotaoNum4.setBorder(null);
        BotaoNum4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum4.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum4ActionPerformed(evt);
            }
        });

        BotaoNum7.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum7.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum7.setText("7");
        BotaoNum7.setBorder(null);
        BotaoNum7.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum7.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum7ActionPerformed(evt);
            }
        });

        BotaoNum9.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum9.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum9.setText("9");
        BotaoNum9.setBorder(null);
        BotaoNum9.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum9.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum9ActionPerformed(evt);
            }
        });

        BotaoNum8.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum8.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum8.setText("8");
        BotaoNum8.setBorder(null);
        BotaoNum8.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum8.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum8ActionPerformed(evt);
            }
        });

        BotaoNum6.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum6.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum6.setText("6");
        BotaoNum6.setBorder(null);
        BotaoNum6.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum6.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum6ActionPerformed(evt);
            }
        });

        BotaoNum5.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum5.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum5.setText("5");
        BotaoNum5.setBorder(null);
        BotaoNum5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum5.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum5ActionPerformed(evt);
            }
        });

        BotaoNum3.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum3.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum3.setText("3");
        BotaoNum3.setBorder(null);
        BotaoNum3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum3.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum3ActionPerformed(evt);
            }
        });

        BotaoNum2.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum2.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum2.setText("2");
        BotaoNum2.setBorder(null);
        BotaoNum2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum2.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum2ActionPerformed(evt);
            }
        });

        BotaoNum0.setBackground(new java.awt.Color(0, 0, 0));
        BotaoNum0.setForeground(new java.awt.Color(255, 255, 255));
        BotaoNum0.setText("0");
        BotaoNum0.setBorder(null);
        BotaoNum0.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoNum0.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoNum0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoNum0ActionPerformed(evt);
            }
        });

        BotaoVirgula.setBackground(new java.awt.Color(0, 0, 0));
        BotaoVirgula.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BotaoVirgula.setForeground(new java.awt.Color(255, 255, 255));
        BotaoVirgula.setText(",");
        BotaoVirgula.setToolTipText("");
        BotaoVirgula.setBorder(null);
        BotaoVirgula.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoVirgula.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoVirgula.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoVirgulaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(BotaoNum0, javax.swing.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoVirgula, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(BotaoNum1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoNum2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoNum3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(BotaoNum4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoNum5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoNum6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addComponent(BotaoNum7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoNum8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotaoNum9, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(BotaoNum9, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoNum7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoNum8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(BotaoNum6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoNum4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoNum5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(42, 42, 42)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(BotaoNum0, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoVirgula, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(BotaoNum3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoNum1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotaoNum2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(36, 36, 36)))
                .addContainerGap())
        );

        jPanel7.setBackground(new java.awt.Color(0, 0, 0));
        jPanel7.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jPanel7.setMaximumSize(new java.awt.Dimension(96, 30));
        jPanel7.setMinimumSize(new java.awt.Dimension(96, 30));

        BotaoTangente.setBackground(new java.awt.Color(0, 0, 0));
        BotaoTangente.setForeground(new java.awt.Color(255, 255, 255));
        BotaoTangente.setText("tg");
        BotaoTangente.setBorder(null);
        BotaoTangente.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoTangente.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoTangente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoTangenteActionPerformed(evt);
            }
        });

        BotaoSeno.setBackground(new java.awt.Color(0, 0, 0));
        BotaoSeno.setForeground(new java.awt.Color(255, 255, 255));
        BotaoSeno.setText("sin");
        BotaoSeno.setBorder(null);
        BotaoSeno.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoSeno.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoSeno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoSenoActionPerformed(evt);
            }
        });

        BotaoCosseno.setBackground(new java.awt.Color(0, 0, 0));
        BotaoCosseno.setForeground(new java.awt.Color(255, 255, 255));
        BotaoCosseno.setText("cos");
        BotaoCosseno.setBorder(null);
        BotaoCosseno.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoCosseno.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoCosseno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoCossenoActionPerformed(evt);
            }
        });

        BotaoCotangente.setBackground(new java.awt.Color(0, 0, 0));
        BotaoCotangente.setForeground(new java.awt.Color(255, 255, 255));
        BotaoCotangente.setText("ctg");
        BotaoCotangente.setBorder(null);
        BotaoCotangente.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoCotangente.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoCotangente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoCotangenteActionPerformed(evt);
            }
        });

        BotaoSecante.setBackground(new java.awt.Color(0, 0, 0));
        BotaoSecante.setForeground(new java.awt.Color(255, 255, 255));
        BotaoSecante.setText("sec");
        BotaoSecante.setBorder(null);
        BotaoSecante.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoSecante.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoSecante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoSecanteActionPerformed(evt);
            }
        });

        BotaoCossecante.setBackground(new java.awt.Color(0, 0, 0));
        BotaoCossecante.setForeground(new java.awt.Color(255, 255, 255));
        BotaoCossecante.setText("csc");
        BotaoCossecante.setBorder(null);
        BotaoCossecante.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        BotaoCossecante.setMargin(new java.awt.Insets(2, 2, 2, 2));
        BotaoCossecante.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoCossecanteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(BotaoSeno, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoCosseno, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(BotaoTangente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoCotangente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(BotaoSecante, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(BotaoCossecante, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotaoSeno, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoCosseno, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotaoTangente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoCotangente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotaoSecante, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoCossecante, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        RadioBotaoGraus.setBackground(new java.awt.Color(180, 94, 7));
        buttonGroup1.add(RadioBotaoGraus);
        RadioBotaoGraus.setForeground(new java.awt.Color(255, 255, 255));
        RadioBotaoGraus.setSelected(true);
        RadioBotaoGraus.setText("Graus");
        RadioBotaoGraus.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        RadioBotaoGraus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RadioBotaoGrausActionPerformed(evt);
            }
        });

        RadioBotaoRad.setBackground(new java.awt.Color(180, 94, 7));
        buttonGroup1.add(RadioBotaoRad);
        RadioBotaoRad.setForeground(new java.awt.Color(255, 255, 255));
        RadioBotaoRad.setText("Radianos");
        RadioBotaoRad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RadioBotaoRadActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, 0, 380, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(RadioBotaoGraus)
                                            .addComponent(RadioBotaoRad))
                                        .addGap(41, 41, 41))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 90, Short.MAX_VALUE)
                .addGap(7, 7, 7)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(RadioBotaoRad)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(RadioBotaoGraus)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel6, 0, 154, Short.MAX_VALUE)))
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8))
        );

        jMenu1.setMnemonic('i');
        jMenu1.setText("Iniciar");
        jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu1MouseClicked(evt);
            }
        });

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Sobre");
        jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuItem1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jMenuItem1MouseEntered(evt);
            }
        });
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem2.setText("Manual");
        jMenuItem2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuItem2MouseClicked(evt);
            }
        });
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 408, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void JVisor1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JVisor1ActionPerformed
        // TODO add your handling code here:

}//GEN-LAST:event_JVisor1ActionPerformed

private void BotaoC1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoC1ActionPerformed
    Operacional.num1 = 0;
    Operacional.num2 = 0;
  
    JVisor1.setText(Control.clearField());
}//GEN-LAST:event_BotaoC1ActionPerformed

private void BotaoBSpace1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoBSpace1ActionPerformed
    try
    {
    JVisor1.setText(Control.backs());
    
    }catch(StringIndexOutOfBoundsException e)
    {
        JVisor1.setText("");
    }
}//GEN-LAST:event_BotaoBSpace1ActionPerformed

private void BotaoCE1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoCE1ActionPerformed
    Operacional.num2 = 0;
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.num1));
}//GEN-LAST:event_BotaoCE1ActionPerformed

private void BotaoMCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMCActionPerformed
    Control.mClear();
}//GEN-LAST:event_BotaoMCActionPerformed

private void BotaoMRActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMRActionPerformed
    try
    {
        JVisor1.setText("");
        df1.setMaximumFractionDigits(Operacional.dec);
        df1.setMinimumFractionDigits(Operacional.dec);
        JVisor1.setText(df1.format(Control.mReturn()).replace(",","."));
    }catch(NumberFormatException e)
    {
        JVisor1.setText("");
    }
}//GEN-LAST:event_BotaoMRActionPerformed

private void BotaoMMaisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMMaisActionPerformed
    try
    {
        Operacional.num1 = Double.parseDouble(JVisor1.getText());
        Control.mMais(Operacional.num1);
        JVisor1.setText("");
    }catch(NumberFormatException e)
    {
        JVisor1.setText("");
    }
}//GEN-LAST:event_BotaoMMaisActionPerformed

private void BotaoMSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMSActionPerformed
    try
    {
    Operacional.num1 = Double.parseDouble(JVisor1.getText());
    Control.mSave(Operacional.num1);
    }catch(NumberFormatException e)
    {
        JVisor1.setText("");
    }
}//GEN-LAST:event_BotaoMSActionPerformed

private void BotaoMMenosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMMenosActionPerformed
    try
    {
        Operacional.num1 = Double.parseDouble(JVisor1.getText());
        Control.mMenos(Operacional.num1);
        JVisor1.setText("");
    }catch(NumberFormatException e)
    {
        JVisor1.setText("");
    }
}//GEN-LAST:event_BotaoMMenosActionPerformed

private void BotaoSinalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoSinalActionPerformed
    try
    {  
        Control.setTemp(JVisor1.getText());
        Operacional.tempNum = Double.parseDouble(Control.getTemp().replace(",","."));
        df1.setMaximumFractionDigits(Operacional.dec);
        df1.setMinimumFractionDigits(Operacional.dec);
        JVisor1.setText(df1.format(Operacional.chs()));
     }catch(NumberFormatException e)
    {
        JVisor1.setText("");
    }
}//GEN-LAST:event_BotaoSinalActionPerformed

private void BotaoMenosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMenosActionPerformed
    try
    {
        Control.setTemp(JVisor1.getText());
        Operacional.operation = 2;
        Operacional.num1 = Double.parseDouble(Control.getTemp().replace(",","."));
        
        JVisor1.setText("");
    }
    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoMenosActionPerformed

private void BotaoMaisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoMaisActionPerformed
       try
       {
            Control.setTemp(JVisor1.getText());
            Operacional.operation = 1;
            Operacional.num1 = Double.parseDouble(Control.getTemp().replace(",","."));
            JVisor1.setText("");
       }
           catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText().replace(",","."));
    }
}//GEN-LAST:event_BotaoMaisActionPerformed

private void BotaoDivActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoDivActionPerformed
    try
    {
     Control.setTemp(JVisor1.getText());
     Operacional.operation = 4;
     Operacional.num1 = Double.parseDouble(Control.getTemp().replace(",","."));
     JVisor1.setText("");
    }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
    catch(IllegalArgumentException e)
    {
        JVisor1.setText(e.getMessage());
    }
}//GEN-LAST:event_BotaoDivActionPerformed

private void BotaoVezesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoVezesActionPerformed
    try
    {
        Control.setTemp(JVisor1.getText());
        Operacional.operation = 3;
        Operacional.num1 = Double.parseDouble(Control.getTemp().replace(",","."));
    JVisor1.setText("");
    }
        catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoVezesActionPerformed

private void BotaoLnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoLnActionPerformed
   try
   {
        Control.setTemp(JVisor1.getText());
        Operacional.num1 = Double.parseDouble(Control.getTemp().replace(",","."));
        Operacional.resul = Aritmetic.ln(Operacional.num1);
        df1.setMaximumFractionDigits(Operacional.dec);
        df1.setMinimumFractionDigits(Operacional.dec);
        JVisor1.setText(df1.format(Operacional.resul));

   }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoLnActionPerformed

private void BotaoLog10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoLog10ActionPerformed
   try
   {      
       Control.setTemp(JVisor1.getText());
       Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Aritmetic.log10(Operacional.num1);
        df1.setMaximumFractionDigits(Operacional.dec);
        df1.setMinimumFractionDigits(Operacional.dec);
        JVisor1.setText(df1.format(Operacional.resul));

   }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoLog10ActionPerformed

private void BotaoPotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoPotActionPerformed
    try
    {
        Operacional.operation = 5;
    Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
    JVisor1.setText("");
    }
        catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoPotActionPerformed

private void BotaoQuadradoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoQuadradoActionPerformed
    try
    {    
        Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Aritmetic.quad(Operacional.num1);
        df1.setMaximumFractionDigits(Operacional.dec);
        df1.setMinimumFractionDigits(Operacional.dec);
        JVisor1.setText(df1.format(Operacional.resul));

    }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoQuadradoActionPerformed

private void BotaoFatorialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoFatorialActionPerformed
    try
    {
        Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Aritmetic.fat(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
    catch(IllegalArgumentException e)
    {
        JVisor1.setText(e.getMessage());
    }
}//GEN-LAST:event_BotaoFatorialActionPerformed

private void BotaoExpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoExpActionPerformed
    try
    {
    Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
    Operacional.resul = Aritmetic.exp(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoExpActionPerformed

private void BotaoRaizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoRaizActionPerformed
   try
   {
        Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Aritmetic.raiz(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
   }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
   catch(IllegalArgumentException e)
    {
        JVisor1.setText(e.getMessage());
    }
}//GEN-LAST:event_BotaoRaizActionPerformed

private void BotaoPcentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoPcentActionPerformed
    try
    {
        Operacional.num2 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Aritmetic.pcent(Operacional.num1, Operacional.num2);
        df1.setMaximumFractionDigits(Operacional.dec);
        df1.setMinimumFractionDigits(Operacional.dec);
        JVisor1.setText(df1.format(Operacional.resul));
    }
        catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }
}//GEN-LAST:event_BotaoPcentActionPerformed

private void BotaoIgualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoIgualActionPerformed
    try
    {
    Operacional.num2 = Double.parseDouble(JVisor1.getText().replace(",","."));
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.igual()));

    }    catch(NumberFormatException e)
    {
        JVisor1.setText(JVisor1.getText());
    }   catch(IllegalArgumentException e)
    {
        JVisor1.setText(e.getMessage());
    }
}//GEN-LAST:event_BotaoIgualActionPerformed

private void BotaoNum1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum1ActionPerformed
    JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"1"));
}//GEN-LAST:event_BotaoNum1ActionPerformed

private void BotaoNum4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum4ActionPerformed
         JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"4"));
}//GEN-LAST:event_BotaoNum4ActionPerformed

private void BotaoNum7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum7ActionPerformed
       JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"7"));
}//GEN-LAST:event_BotaoNum7ActionPerformed

private void BotaoNum9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum9ActionPerformed
    JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"9"));
}//GEN-LAST:event_BotaoNum9ActionPerformed

private void BotaoNum8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum8ActionPerformed
    JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"8")); 
}//GEN-LAST:event_BotaoNum8ActionPerformed

private void BotaoNum6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum6ActionPerformed
    JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"6"));  
}//GEN-LAST:event_BotaoNum6ActionPerformed

private void BotaoNum5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum5ActionPerformed
    JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"5"));              
}//GEN-LAST:event_BotaoNum5ActionPerformed

private void BotaoNum3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum3ActionPerformed
    JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"3"));
}//GEN-LAST:event_BotaoNum3ActionPerformed

private void BotaoNum2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum2ActionPerformed
   JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"2"));
}//GEN-LAST:event_BotaoNum2ActionPerformed

private void BotaoNum0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoNum0ActionPerformed
      try
      {
          JVisor1.setText(Control.DigitarNumero(JVisor1.getText(),"0"));
      }catch (NullPointerException e)
      {
          JVisor1.setText("Invalid CODE");
      }
}//GEN-LAST:event_BotaoNum0ActionPerformed

private void BotaoTangenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoTangenteActionPerformed
   try
   {
        Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Trigonometrica.tg(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
   }catch(IllegalArgumentException e)
   {
       JVisor1.setText(JVisor1.getText());
   }
}//GEN-LAST:event_BotaoTangenteActionPerformed

private void BotaoSenoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoSenoActionPerformed
    try
    {
    Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
    Operacional.resul = Trigonometrica.sen(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }catch(IllegalArgumentException e)
   {
       JVisor1.setText(JVisor1.getText());
   }
}//GEN-LAST:event_BotaoSenoActionPerformed

private void BotaoCossenoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoCossenoActionPerformed
    try
    {
    Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
    Operacional.resul = Trigonometrica.cos(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }catch(IllegalArgumentException e)
   {
       JVisor1.setText(JVisor1.getText());
   }
}//GEN-LAST:event_BotaoCossenoActionPerformed

private void BotaoCotangenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoCotangenteActionPerformed
    try
    {
    Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
    Operacional.resul = Trigonometrica.ctg(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }catch(IllegalArgumentException e)
   {
       JVisor1.setText(JVisor1.getText());
   }
}//GEN-LAST:event_BotaoCotangenteActionPerformed

private void BotaoSecanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoSecanteActionPerformed
    try
    {
        Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Trigonometrica.sec(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }catch(IllegalArgumentException e)
   {
       JVisor1.setText(JVisor1.getText());
   }
}//GEN-LAST:event_BotaoSecanteActionPerformed

private void BotaoCossecanteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoCossecanteActionPerformed
    try
    {
        Operacional.num1 = Double.parseDouble(JVisor1.getText().replace(",","."));
        Operacional.resul = Trigonometrica.csc(Operacional.num1);
    df1.setMaximumFractionDigits(Operacional.dec);
    df1.setMinimumFractionDigits(Operacional.dec);
    JVisor1.setText(df1.format(Operacional.resul));
    }catch(IllegalArgumentException e)
   {
       JVisor1.setText(JVisor1.getText());
   }
}//GEN-LAST:event_BotaoCossecanteActionPerformed

private void RadioBotaoGrausActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RadioBotaoGrausActionPerformed
        Trigonometrica.setOpcao(true);
}//GEN-LAST:event_RadioBotaoGrausActionPerformed

private void RadioBotaoRadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RadioBotaoRadActionPerformed
        Trigonometrica.setOpcao(false);
}//GEN-LAST:event_RadioBotaoRadActionPerformed

private void BotaoVirgulaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoVirgulaActionPerformed
    JVisor1.setText(Control.point(JVisor1.getText()));
}//GEN-LAST:event_BotaoVirgulaActionPerformed

private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem1MouseClicked
    new JFrameSobre().show();
}//GEN-LAST:event_jMenuItem1MouseClicked

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
    new JFrameManual().setVisible(true);
}//GEN-LAST:event_jMenuItem2ActionPerformed

private void jMenuItem1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem1MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_jMenuItem1MouseEntered

private void JSeletorDecStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_JSeletorDecStateChanged


        
    if(JSeletorDec.getValue().equals(0))
      Operacional.dec = 0;  
    if(JSeletorDec.getValue().equals(1))
      Operacional.dec = 1;  
    if(JSeletorDec.getValue().equals(2))
      Operacional.dec = 2;  
    if(JSeletorDec.getValue().equals(3))
      Operacional.dec = 3;  
    if(JSeletorDec.getValue().equals(4))
      Operacional.dec = 4;  
    if(JSeletorDec.getValue().equals(5))
      Operacional.dec = 5; 
    if(JSeletorDec.getValue().equals(6))
      Operacional.dec = 6;  
    if(JSeletorDec.getValue().equals(7))
      Operacional.dec = 7;  
    if(JSeletorDec.getValue().equals(8))
      Operacional.dec = 8;  
    if(JSeletorDec.getValue().equals(9))
      Operacional.dec = 9;  
}//GEN-LAST:event_JSeletorDecStateChanged

private void JVisor1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_JVisor1KeyTyped
    char num = evt.getKeyChar();
    if(!Character.isDigit(num))
        evt.consume();
}//GEN-LAST:event_JVisor1KeyTyped

private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_jMenu1MouseClicked

private void jMenuItem2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem2MouseClicked
    new JFrameManual().show();
}//GEN-LAST:event_jMenuItem2MouseClicked

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
    new JFrameSobre().setVisible(true);
}//GEN-LAST:event_jMenuItem1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JFramePrincipal().setVisible(true);
        }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotaoBSpace1;
    private javax.swing.JButton BotaoC1;
    private javax.swing.JButton BotaoCE1;
    private javax.swing.JButton BotaoCossecante;
    private javax.swing.JButton BotaoCosseno;
    private javax.swing.JButton BotaoCotangente;
    private javax.swing.JButton BotaoDiv;
    private javax.swing.JButton BotaoExp;
    private javax.swing.JButton BotaoFatorial;
    private javax.swing.JButton BotaoIgual;
    private javax.swing.JButton BotaoLn;
    private javax.swing.JButton BotaoLog10;
    private javax.swing.JButton BotaoMC;
    private javax.swing.JButton BotaoMMais;
    private javax.swing.JButton BotaoMMenos;
    private javax.swing.JButton BotaoMR;
    private javax.swing.JButton BotaoMS;
    private javax.swing.JButton BotaoMais;
    private javax.swing.JButton BotaoMenos;
    private javax.swing.JButton BotaoNum0;
    private javax.swing.JButton BotaoNum1;
    private javax.swing.JButton BotaoNum2;
    private javax.swing.JButton BotaoNum3;
    private javax.swing.JButton BotaoNum4;
    private javax.swing.JButton BotaoNum5;
    private javax.swing.JButton BotaoNum6;
    private javax.swing.JButton BotaoNum7;
    private javax.swing.JButton BotaoNum8;
    private javax.swing.JButton BotaoNum9;
    private javax.swing.JButton BotaoPcent;
    private javax.swing.JButton BotaoPot;
    private javax.swing.JButton BotaoQuadrado;
    private javax.swing.JButton BotaoRaiz;
    private javax.swing.JButton BotaoSecante;
    private javax.swing.JButton BotaoSeno;
    private javax.swing.JButton BotaoSinal;
    private javax.swing.JButton BotaoTangente;
    private javax.swing.JButton BotaoVezes;
    private javax.swing.JButton BotaoVirgula;
    private javax.swing.JSpinner JSeletorDec;
    private javax.swing.JTextField JVisor1;
    private javax.swing.JRadioButton RadioBotaoGraus;
    private javax.swing.JRadioButton RadioBotaoRad;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    // End of variables declaration//GEN-END:variables
}
